<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const containsDuplicate = nums => {
            let arr = [];

            for (let i = 0; i < nums.length; i++) {
                if (arr.indexOf(arr[i]) === -1) {
                    console.log(arr.indexOf[i]);
                    arr.push(nums[i])
                } else {
                    continue
                }
            }
            // console.log(arr);
            if (arr != nums) {
                return false
            } else {
                return true
            }
        }

        console.log(containsDuplicate([1, 2, 3, 1]));

    </script>
</body>

</html>